/**
 * 
 */
RegisterPage = {
		
		'BindEvent': function(){
			$('#btn_submit').bind('click', function(){
				var param_en = {};
				param_en.promoter_type	= $("input[name='promoter_type']:checked").val();
				param_en.cellphone		= $("#cellphone").val();
				param_en.sex			= $("input[name='sex']:checked").val();
				param_en.real_name		= $("#real_name").val();
				param_en.password		= $("#password").val();
				param_en.district_id	= $("#ssl_district").val();
				param_en.address		= $("#address").val();
				param_en.alipay_id		= $("#alipay_id").val();
				param_en.alipay_name	= $("#alipay_name").val();
				param_en.share_code		= $("#share_code").val();
				param_en.id_card_no		= $("#id_card_no").val();
				
				if($("#chkPrivacy").is(":checked") == false){
					alert("必需同意隐私条款方可注册！");
					return;
				}

				if($("input[name='promoter_type'][checked]").val() == 2 && param_en.id_card_no == ""){
					alert("经销商必须要填写营业执照！");
					return;
				}

				var result = AdminService.VerifyRegister(param_en);
				if(result.IsSuccess == 0){
					alert(result.ErrorMsg);
					return;
				}
				else{
					$('#formReg').submit();
				}
			});
			
			
			$("input[name='promoter_type']").bind('change', function(){
				var promoter_type = $("input[name='promoter_type']:checked").val();
				if(promoter_type == 1){
					$('#div_agency').hide();
				}
				else{
					$('#div_agency').show();
				}
			});
			
		},
};

$(document).ready(function(){
	CommonUtil.InitRegion();
	RegisterPage.BindEvent();
	$("input[name='promoter_type']").trigger('change');
});


